home *** CD-ROM | disk | FTP | other *** search
/ Aminet 45 / Aminet 45 (2001)(GTI - Schatztruhe)[!][Oct 2001].iso / Aminet / util / boot / MuRedox.readme < prev    next >
Encoding:
Text File  |  2001-09-05  |  15.3 KB  |  373 lines

  1. Short:    MuLib based math speedup patch for 040/060
  2. Author:   thor@math.tu-berlin.de (Thomas Richter)
  3. Uploader: thor@math.tu-berlin.de (Thomas Richter)
  4. Type:     util/boot
  5. Requires: util/libs/MMULib.lha Kickstart V37, MuLib 68040/68060 lib
  6.  
  7.  
  8. MuRedox is a MuLib based "on the fly" speedup patch for 68040
  9. and 68060 based Amiga boards. The 68040 and 68060 do not implement
  10. all instructions of the MC 68K family. The unimplemented instructions -
  11. mainly FPU instructions - generate an exception and need to be 
  12. emulated by the 68040 resp. 68060.library. This is the job of the so-
  13. called "FPSP routines" (floating point support package) within the
  14. CPU libraries. MuRedox detects these instructions as soon as they
  15. generate the emulator exceptions, runs a "just-in-time" compiler
  16. that generates a "stub replacement routine" for this specific
  17. instruction and patches the replacement routine into the running
  18. program. Hence, MuRedox replaces the overhead of the emulator
  19. trap on the next use of the same instruction sequence.
  20.  
  21. Therefore, MuRedox requires:
  22.  
  23. - At least an 68040 or an 68060. A 68030 or below implements all
  24.   instructions anyhow and does not require emulator traps at all.
  25.  
  26. - The mmu.library which is required to setup the special memory
  27.   mapping.
  28.  
  29. - The fpsp.resource. This resource contains the program code required
  30.   for most unimplemented math functions. This resource is made avail-
  31.   available by the mmu.library-based 68040 and 68060.library. 
  32.  
  33.   Therefore, installation of the "MuLib" libraries is *required*.
  34.   Please see the "MMULib.lha" package on Aminet how to install them.
  35.  
  36. ------------------------------------------------------------------------------
  37.  
  38. Top reasons why not to use this program:
  39.  
  40. - It is a hack. MuRedox replaces program code on the fly, hoping that all
  41.   will go well. This need not to be the case - especially commercial
  42.   programs may keep a checksum over their code and may fail if their
  43.   code gets altered. MuRedox will perform such code modifications.
  44.  
  45. - MuRedox will therefore not work for all programs - some 
  46.   incompatibilities should be expected.
  47.  
  48. If you need faster programs, you should rather:
  49.  
  50. - Ask the vendor for a 68060 or 68040 specific release of the program
  51.   that does not require the software emulated instructions of the 68040
  52.   resp. 68060. Typically, these versions will run faster than a 
  53.   68020/68030 version with MuRedox, anyhow.
  54.  
  55. - Remember: Programs are made fast by fast and smart algorithms, not by
  56.   your favourite speedup-patch. MuRedox will give some speed impact,
  57.   in realistic situations in the range of at most 10%. Specific bench-
  58.   marks may show more dramatic improvements, but they typically test
  59.   situations that are untypical in a real-life situation. Motorola
  60.   choose less frequently used instructions for software emulation in
  61.   first place, hence improvements are typically marginal.
  62.  
  63. ------------------------------------------------------------------------------
  64.  
  65. Implementation specific:
  66.  
  67. MuRedox is not the first program of this kind. Two other implementations
  68. exist (OxyPatcher and CyberPatcher). MuRedox tries to be better than the
  69. two, of course: (-:
  70.  
  71. - It uses the fpsp.resource for the calculations. This means that the
  72.   result of the calculation is *guaranteed* to be the same than what
  73.   "the real thing" would have generated. The fpsp.resource is internally
  74.   used by the 68040 and 68060.library as well for handling the emulator
  75.   traps. This means that even picky side conditions (as on the rounding
  76.   mode and exception generation) are kept care of. If a software does 
  77.   *NOT* check its own code, then the reaction of the system with MuRedox
  78.   running is undistinguishable from a system running the 040 and 060
  79.   library.
  80. - It is mmu.library aware. This means specifically that it will respect
  81.   "virtual memory" situations where the corresponding code is swapped
  82.   out, or will not try to overwrite code that is write-protected. Hence,
  83.   it will also avoid MuForce hits. It also cooperates nicely with other
  84.   MuTools by its design.
  85. - MuRedox includes emulation routines for almost all instructions that
  86.   would cause emulator traps.
  87. - MuRedox offers a special feature for instructions causing exceptions,
  88.   as for example a "divide by zero". In this case, "MuRedox" removes
  89.   the emulation routine of the offending instruction and replaces it by
  90.   the real instruction again. Programs checking their code especially 
  91.   in these situations will therefore never see the "MuRedox" patches 
  92.   and the program counter of the faulting instruction will be "right
  93.   in place". This trick has also the advantage of generating exactly
  94.   the same instruction type and status as the emulation routines within
  95.   the 68040/68060.library - simply because this emulation routine gets
  96.   used!
  97.   
  98. ------------------------------------------------------------------------------
  99.  
  100. SYNOPSIS:
  101.  
  102. MuRedox EMULATORSIZE=EMUSIZ/N
  103.  
  104. EMULATORSIZE:        Size in K bytes of the output buffer for the
  105.             just-in-time compiler. Emulated instruction sequences
  106.             go into this buffer. If this buffer overruns, 
  107.             MuRedox will no longer be able to replace further
  108.             emulated instructions. 
  109.  
  110.             Defaults to 64K which has shown to be more than
  111.             sufficient for normal operation; typically not more
  112.             than 16K are required.
  113.  
  114. NOTE: MuRedox cannot be removed once it is running. This is intentional as
  115. MuRedox has no control over which programs got altered and whether these
  116. alterations are still active.
  117.  
  118. ------------------------------------------------------------------------------
  119.  
  120.                          The THOR-Software Licence (v2, 24th June 1998)
  121.  
  122.  
  123. This License applies to the computer programs known as "mmu.library", 
  124. "MuRedox", "FPSPSnoop" and the corresponding documentation, known as
  125. ".readme" files. The "Program", below, refers to such program. The "Archive"
  126. refers to the package of distribution, as prepared by the author of the
  127. Program, Thomas Richter. Each licensee is addressed as "you".
  128.  
  129.  
  130.  
  131. The Program and the data in the archive are freely distributable
  132. under the restrictions stated below, but are also Copyright (c)
  133. Thomas Richter.
  134.  
  135. Distribution of the Program, the Archive and the data in the Archive by a
  136. commercial organization without written permission from the author to any
  137. third party is prohibited if any payment is made in connection with such
  138. distribution, whether directly (as in payment for a copy of the Program) or
  139. indirectly (as in payment for some service related to the Program, or
  140. payment for some product or service that includes a copy of the Program
  141. "without charge"; these are only examples, and not an exhaustive enumeration
  142. of prohibited activities).
  143.  
  144.  
  145. However, the following methods of distribution
  146. involving payment shall not in and of themselves be a violation of this
  147. restriction:
  148.  
  149.  
  150. (i) Posting the Program on a public access information storage and
  151. retrieval service for which a fee is received for retrieving information
  152. (such as an on-line service), provided that the fee is not
  153. content-dependent (i.e., the fee would be the same for retrieving the same
  154. volume of information consisting of random data).
  155.  
  156.  
  157. (ii) Distributing the Program on a CD-ROM, provided that
  158.  
  159. a) the Archive is reproduced entirely and verbatim on such CD-ROM, including
  160. especially this licence agreement;
  161.  
  162. b) the CD-ROM is made available to the public for a nominal fee only,
  163.  
  164. c) a copy of the CD is made available to the author for free except for
  165. shipment costs, and
  166.  
  167. d) provided further that all information on such CD-ROM is re-distributable
  168. for non-commercial purposes without charge.
  169.  
  170.  
  171. Redistribution of a modified version of the Archive, the Program or the
  172. contents of the Archive is prohibited in any way, by any organization,
  173. regardless whether commercial or non-commercial. Everything must be kept
  174. together, in original and unmodified form.
  175.  
  176.  
  177.  
  178.  
  179. Limitations.
  180.  
  181.  
  182. THE PROGRAM IS PROVIDED TO YOU "AS IS", WITHOUT WARRANTY. THERE IS NO
  183. WARRANTY FOR THE PROGRAM, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
  184. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  185. PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE
  186. RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD
  187. THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
  188. SERVICING, REPAIR OR CORRECTION.
  189.  
  190.  
  191. IF YOU DO NOT ACCEPT THIS LICENCE, YOU MUST DELETE THE PROGRAM, THE ARCHIVE
  192. AND ALL DATA OF THIS ARCHIVE FROM YOUR STORAGE SYSTEM. YOU ACCEPT THIS
  193. LICENCE BY USING OR REDISTRIBUTING THE PROGRAM.
  194.  
  195.  
  196.                                                         Thomas Richter
  197.  
  198. ______________________________________________________________________________
  199.  
  200. Installation:
  201.  
  202. MuRedox requires the 68040 and 68060.libraries to be installed. Please check
  203. the documentation of the apropriate archives on Aminet and install the
  204. latest versions of the two libraries found in this archive. They fix a minor
  205. bug in the fpsp.resource with is irrelevant for normal operation.
  206.  
  207. MuRedox should then be run from the shell without arguments.
  208.  
  209. *WARNING* Once MuRedox is run, you can't quit it. This is because it is
  210. not clear whether any of the replacement stub routines are still in use
  211. when the program would try to exit.
  212.  
  213. ______________________________________________________________________________
  214.  
  215. In case of trouble:
  216.  
  217. ...or if you think that MuRedox does not speedup your favourite program.
  218.  
  219.  
  220. MuRedox is a pretty tricky program, it might be that this beta-release
  221. contains some bugs, so testing is mandatory. The same goes for situations 
  222. where you think that MuRedox "misses" some instructions that might slow-
  223. down your favourite application. For tracing down these problems, you
  224. need the "FPSPSnoop" program and the "disassembler.library" within this
  225. archive, and possibly a second computer or "Sashimi". The latter can be
  226. found in the Aminet in a separate archive and is not included.
  227.  
  228. Usage of FPSPSnoop is pretty simple: Run it from the shell without
  229. arguments. If you do not own a second computer and a null-modem cable,
  230. you need to run Sashimi as well. FPSPSnoop outputs will then go into the
  231. Sashimi window.
  232.  
  233. The order how programs are run determinates the logic of what is "snooped"
  234. by FPSPSnoop:
  235.  
  236. - Run FPSPSnoop (and Sashimi) first, MuRedox later: Then FPSPnoop will only
  237. snoop instructions that are not handled by MuRedox. This might be useful to
  238. detect cases where MuRedox misses some instructions.
  239.  
  240. - Run MuRedox first, FPSPSnoop (and Sashimi) later: This will snoop *all*
  241. instructions that will be emulated before they are replaced by MuRedox. This
  242. is useful when you suspect that one of the emulation routines of MuRedox
  243. is broken.
  244.  
  245. In either case, I would need the output of FPSPSnoop to fix any problem!
  246. ______________________________________________________________________________
  247.  
  248. Emulated instructions:
  249.  
  250. Thanks to its "just in time compiler", MuRedox is able to replace almost
  251. all instructions that would cause emulator traps. MuRedox does not come 
  252. with a fixed set of stub-routines that are just patched in, it *creates*
  253. these routines as soon as the problem is detected. Therefore, it is maybe
  254. easier to say what MuRedox does not emulate rather than what it does...
  255.  
  256. Integer instructions that get replaced:
  257.  
  258. mulu    64 bit variant, all addressing modes, 68060 only, native on 68040
  259. muls    64 bit variant, all addressing modes, 68060 only, native on 68040
  260. divu    64 bit variant, all addressing modes, 68060 only, native on 68040
  261. divs    64 bit variant, all addressing modes, 68060 only, native on 68040
  262. movep    all addressing modes, 68060 only, native on 68040
  263. cmp2    all addressing modes, 68060 only, native on 68040
  264.  
  265. Integer instructions that get not patched:
  266.  
  267. chk2    This instruction is especially useful for debugging as it will
  268.     cause a "trap" if a condition to be checked is not fulfilled.
  269.     Replacing this instruction may confuse an active debugger.
  270.     Except that I haven't seen any program that makes use of it.
  271. cas    (with odd addresses only) Not useable on amiga hardware due to
  272.     the unsupported read-modify-write cycle that might break DMA
  273.     access.
  274. cas2    Not usable on Amiga hardware due to the unsupported 
  275.     read-modify-write cycle.
  276.  
  277. Integer addressing modes:
  278.  
  279. All supported except (a7)+ as target and -(a7) as source. Both addressing 
  280. modes break the logic of a stack and won't work in a multitasking environ-
  281. ment either. The 68040 and 68060 emulator core doesn't support them either.
  282.  
  283. FPU general instructions:
  284.  
  285. The following are handled by forwarding the emulation to the fpsp.resource:
  286.  
  287. facos        all addressing modes
  288. fasin        all addressing modes
  289. fatan        all addressing modes
  290. fatanh        all addressing modes
  291. fcos        all addressing modes
  292. fcosh        all addressing modes
  293. fetox        all addressing modes
  294. fetoxm1        all addressing modes
  295. fgetexp        all addressing modes
  296. fgetman        all addressing modes
  297. fint        all addressing modes, 68040 only, native on 68060
  298. fintrz        all addressing modes, 68040 only, native on 68060
  299. flog10        all addressing modes
  300. flog2        all addressing modes
  301. flogn        all addressing modes
  302. flognp1        all addressing modes
  303. fmod        all addressing modes
  304. frem        all addressing modes
  305. fscale        all addressing modes
  306. fsin        all addressing modes
  307. fsincos        all addressing modes
  308. fsinh        all addressing modes
  309. ftan        all addressing modes
  310. ftanh        all addressing modes
  311. ftentox        all addressing modes
  312. ftwotox        all addressing modes
  313.  
  314. The following are handled with special emulation routines within MuRedox:
  315.  
  316. fmovecr        all constants, with special versions for 0,1 and 10.
  317. fdbcc        all addressing modes, 68060 only, native on 68040
  318. fscc        all addressing modes, 68060 only, native on 68060
  319.  
  320. Supported floating point addressing modes:
  321.  
  322. All including #immediate.x(extended precision) for which emulation routines
  323. are generated as well for the 68060, and excluding "packed decimal".
  324.  
  325. Instructions that get not patched over:
  326.  
  327. ftrapcc        68060 only, native on 68040
  328.         Mainly useful for debugging, this instruction causes an
  329.         exception if a special FPU condition is met. A debugger
  330.         might depend on this specific instruction, therefore this
  331.         is left alone.
  332.  
  333. fmovem.x    with dynamic register list (in CPU registers), 68060 only,
  334.         native on 68040.
  335. fmovem.l    multiple control registers with immediate operand and more
  336.         than one control register, 68060 only, native on 68040.
  337.  
  338.         I haven't seen any program using these instructions. If you
  339.         need them emulated, prove me that they get used by running
  340.         FPSPSnoop.
  341.  
  342. Addressing modes that are not replaced by emulation code:
  343.  
  344. #immed.p    (packed decimal) and any other packed decimal operation.
  345.  
  346.         Since these instructions are slow even on a 68881/82 CPU,
  347.         they are hardly ever used in speed-critical situations. If
  348.         you really need them emulated, please tell me the program
  349.         that uses them.
  350. ______________________________________________________________________________
  351.  
  352. So long,
  353.  
  354.     Thomas Richter (August 2001)
  355.  
  356.  
  357. ============================= Archive contents =============================
  358.  
  359. Original  Packed Ratio    Date     Time    Name
  360. -------- ------- ----- --------- --------  -------------
  361.     5976    3267 45.3% 19-Aug-01 17:15:10 +FPSPSnoop
  362.    43632   23491 46.1% 19-Aug-01 17:14:34 +68040.library
  363.    64804   30392 53.1% 19-Aug-01 17:14:38 +68060.library
  364.    17240   10053 41.6% 19-Aug-01 17:14:44 +disassembler.library
  365.    43976   23311 46.9% 19-Aug-01 17:14:26 +mmu.library
  366.     9548    5689 40.4% 26-Aug-01 13:36:28 +MuRedox
  367.    22975    8304 63.8% 26-Aug-01 13:38:12 +MuRedox.guide
  368.      523     273 47.8% 26-Aug-01 13:38:28 +MuRedox.guide.info
  369.     1083     553 48.9% 26-Aug-01 13:38:28 +MuRedox.info
  370.    14829    5602 62.2% 25-Aug-01 14:22:30 +MuRedox.readme
  371. -------- ------- ----- --------- --------
  372.   224586  110935 50.6% 28-Aug-101 02:45:54   10 files
  373.